package be.rubengerits.bluetooth.tester.bluetooth;
import android.bluetooth.*;
import android.content.*;
import java.util.concurrent.*;

public class BluetoothUtil {
	
	private static BluetoothUtil instance;
	
	public static BluetoothUtil getInstance() throws Exception {
		if (instance == null) {
			instance = new BluetoothUtil();
		}
		return instance;
	}
	
	public void sendText(String deviceName, String message) throws Exception {
		BluetoothAdapter a = getAdapter();
		
		a.getBondedDevices().iterator();
		
		//new ThreadFactory().newThread(new BluetoothConnection());
		//new BluetoothConnection();
	}
	
	private BluetoothAdapter getAdapter() throws Exception {
		BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
		if (bluetoothAdapter == null) {
			throw new Exception("Device does not support Bluetooth");
		}
		
		if (!bluetoothAdapter.isEnabled()) {
			bluetoothAdapter.enable();
		}
		
		return bluetoothAdapter;
	}
}
